from flask_restful import Resource

from restful.api__.session import  login_required_current_user_generate, \
    uid_required_target_user_generate
from restful.model.query import QueryOneInstance
from restful.model.tables import Personal
from restful.response import ResponseSuccess


class PersonalInfo(Resource):
    @login_required_current_user_generate
    @uid_required_target_user_generate
    def get(self,target_user,current_user):
        personal = QueryOneInstance(Personal,{'uid':target_user.id})
        return ResponseSuccess(data={
            'intro':personal.intro,
            'img_icon':personal.img_icon,
            'img_background':personal.img_background,
        })